import pymysql

connection = pymysql.connect(host='localhost', user='root', password='123456', db='test')
cursor = connection.cursor()
cursor.execute(
    '''
    CREATE TABLE IF NOT EXISTS tb_users (
        id INT PRIMARY KEY AUTO_INCREMENT,
        username VARCHAR(20) NOT NULL UNIQUE,
        password VARCHAR(20) NOT NULL
    );
    '''
)

connection.commit()
print('Table created successfully')

cursor.close()
connection.close()

